/*
 * Copyright (c) 2006, 2021, webrx.cn All rights reserved.
 *
 */
package cn.webrx.controller;

import org.springframework.web.bind.annotation.*;

import java.io.PrintWriter;

/**
 * <p>Project: springmvc2021 - HomeController
 * <p>Powered by webrx On 2021-11-05 16:43:32
 * <p>Created by IntelliJ IDEA
 *
 * @author webrx [webrx@126.com]
 * @version 1.0
 * @since 17
 */
@RestController
@RequestMapping("/user")
public class HomeController {

    @GetMapping("/show")
    //@ResponseBody
    public String show() {
        return "hello"; //hello视图文件 1.jsp文件  2.freemarker ftl模板文件 3.thymeleaf html5模板引擎
    }

    @GetMapping("/aa")
    public void aa(PrintWriter out) {
        out.print("<style>body{color:red}</style>");
        out.print("hello world 中文 printwriter");
    }

    @RequestMapping({"/", "/index", "/home", "/index.html"})
    public String index(String name) {
        return "user 用户中心首页 姓名：" + name;
    }

    //RESTFUL 风格
    @RequestMapping(value = "/abc/{nn}", method = RequestMethod.GET)
    public String abc(@PathVariable("nn") String name) {
        return "user 用户中心首页 姓名：" + name;
    }
}
